﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _3.Person
{
    public class Person
    {
        private string firstName;
        private string lastName;
        private DateTime birthDate;
        private readonly string Gender = "F";

        public string FirstName
        {
            get { return this.firstName; }
            set
            {
                if (this.firstName != value)
                {
                    this.firstName = value;
                    OnFirstNameChanged();
                }
            }
        }

        private void OnFirstNameChanged()
        {
            if (this.FirstNameChanged != null)
            {
                this.FirstNameChanged(this, EventArgs.Empty);
            }
        }

        public string LastName
        {
            get { return this.lastName; }
            set
            {
                if (this.lastName != value)
                {
                    this.lastName = value;
                    OnLastNameChanged();
                }
            }
        }

        private void OnLastNameChanged()
        {
            if (this.LastNameChanged != null)
            {
                this.LastNameChanged(this, EventArgs.Empty);
            }
        }

        public DateTime BirthDate
        {
            get { return this.birthDate; }
            set
            {
                if (this.birthDate != value)
                {
                    this.birthDate = value;
                    OnBirthDateChanged();
                }
            }
        }

        private void OnBirthDateChanged()
        {
            if (this.BirthDateChanged != null)
            {
                this.BirthDateChanged(this, EventArgs.Empty);
            }
        }

        public event EventHandler FirstNameChanged;
        public event EventHandler LastNameChanged;
        public event EventHandler BirthDateChanged;                
    }
}
